///////////////////////////////////////////////////////////////////////////////
// Project: Hoyo Client Game
//
// hy_server_monster_data.h
// Created: 2013-7-30
// Author: Like Cheng
///////////////////////////////////////////////////////////////////////////////
#pragma once
#include "hy_includes.h"

class hy_server_monster_data
{
public:
	hy_server_monster_data();
	virtual ~hy_server_monster_data();

	bool				init();	

	int					get_id(){ return m_monster_id; }
	void				set_id( int id ){ m_monster_id = id; }
	void				set_value( Json::Value& v );
	float				get_attack_param(){ if( m_param_vec.size() >= 1 )return m_param_vec.at( 0 ); else return 0.0f; }
	float				get_agile_param(){ if( m_param_vec.size() >= 2 )return m_param_vec.at( 1 ); else return 0.0f; }
	float				get_hp_param(){ if( m_param_vec.size() >= 3 )return m_param_vec.at( 2 ); else return 0.0f; }
public:
	int					m_monster_id;
	int					m_headicon;
	int					m_model;
	float				m_scale;
	int					m_model_color;
	int					m_back_plug_resid;
	int					m_attack;
	int					m_hp;
	int					m_agile;
	float_vec			m_param_vec;
	int_set				m_skill_set;

	Json::Value			m_value;
	int					m_load_dirty;
};

typedef std::map< int, hy_server_monster_data* > hy_server_monster_data_map;

class hy_server_monster_mgr
{
public:
	hy_server_monster_mgr();
	virtual ~hy_server_monster_mgr();

	static hy_server_monster_mgr* instance();
	static void	purge_instance();

	bool					add_server_monster_data( hy_server_monster_data* , bool is_update = false );
	hy_server_monster_data*	get_server_monster_data( int id );

	hy_server_monster_data_map&	get_server_monster_data_map(){ return m_server_monster_data_map; }

private:
	hy_server_monster_data_map				m_server_monster_data_map;
};